﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="reportPage.aspx.cs" Inherits="BSC.report.reportPage" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
     <script type="text/javascript">
        var addTab = function (tabPanel, id, url,title) {
            var tab = tabPanel.getComponent(id);

            if (!tab) {
                tab = tabPanel.add({ 
                    id       : id, 
                    title    : title, 
                    closable : true,                    
                    autoLoad : {
                        showMask : true,
                        url      : url,
                        mode     : "iframe",
                        maskMsg  : "Đang tải " + title + "..."
                    }                    
                });

                /*tab.on("activate", function () {
                    var item = MenuPanel1.menu.items.get(id + "_item");
                    
                    if (item) {
                        MenuPanel1.setSelection(item);
                    }
                }, this);*/
            }
            
            tabPanel.setActiveTab(tab);
        }
        var Reload = function(tabPanel) {
            var tab = tabPanel.getActiveTab();
            tab.reload(); 
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <ext:Viewport ID="Viewport1" runat="server" Layout="Border">
        
        <Items> 
            <ext:BorderLayout ID="Panel1" runat="server" >
                <West MinWidth="200"  Collapsible="true" >    
                                  
                    <ext:Panel ID="Panel8" runat="server" Width="200" Flex="1" Layout="FitLayout">
                        <Items>
                            <ext:TreePanel ID="Panel9" runat="server" Title="Danh mục báo cáo" FormGroup="true" BodyBorder="false">
                                <Root>
                                    <ext:TreeNode Text="Kế toán">
                                        <Nodes>
                                            <ext:TreeNode Text="Doanh thu">
                                                <Listeners>
                                                    <Click Handler="addTab(#{panTab},'idDTCP','/report/r_cost_revenues.aspx','Doanh thu/Chi phí')" />
                                                </Listeners>
                                            </ext:TreeNode>
                                        </Nodes>
                                    </ext:TreeNode>
                                </Root>
                            </ext:TreePanel>
                        </Items>
                    </ext:Panel>
                </west>
                <Center>
                    <ext:TabPanel ID="panTab" runat="server" Margins="5" Region="Center" Padding="10">
                        <TopBar>
                            <ext:Toolbar>
                                <Items>
                                    <ext:Button runat="server" ID="btnReload" Text="Tải lại" Icon="Reload">
                                        <Listeners>
                                            <Click Handler="Reload(#{panTab})" />
                                        </Listeners>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <LoadMask Msg="Đang tải dữ liệu..." />
                    </ext:TabPanel>
                </Center>
            </ext:BorderLayout>
            
            
        </Items>
    </ext:Viewport>
</asp:Content>
